<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <style>
        *{
            list-style: none;
        }
        .c li {
            width: 200px;
            height: 100px;
            margin: 20px;
            padding: 20px;
            border: 1px solid orange;
           display: inline-block;
           color:#fff
        }
    </style>
</head>

<body>
    <div id="app">
        <h1>海底捞评价：</h1>
        <ul>
            <!-- 循环那个标签，v-for就在那个标签上 -->
            <!-- v-for='(item,index) in 循环数据'  item:循环数据的每一项 index:下标  -->
            <li v-for="(item,index) in comments">{{index}}-----{{item}}</li>
        </ul>

        <!-- 课程内容 -->
        <ul class="c">
            <!-- index不要的时候可以省略 -->
            <li v-for="item in course" :style="{background:item.color}">
                <p>课程名称:{{item.title}}</p>
                <p>课程价格:{{item.price == 0 ? "免费" : item.price}}</p>
            </li>
        </ul>
    </div>
    <script>
        new Vue({
            el: "#app",
            data: {
                //评论
                comments: ["不错，服务特别好", "太辣了", "太贵了", "非常好，就是太贵了"],
                //课程
                course: [
                    {
                        id: 1,
                        title: "暑假班",
                        price: 200,
                        color:"teal"
                    },
                    {
                        id: 2,
                        title: "英语特长班",
                        price: 0,
                        color:"pink"
                    },
                    {
                        id: 3,
                        title: "疯狂屋里",
                        price: 299,
                        color:"blue"
                    },
                    {
                        id: 4,
                        title: "疯狂化学",
                        price: 1000,
                        color:"orange"
                    }
                ]
            },
            methods: {}
        })
    </script>
</body>

</html>